<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="crm.model.Employees"%>
<%@page import="crm.util.ParamUtil"%>
<%@page import="crm.util.ToPinyin"%>
<%@page import="crm.control.EmployeesControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>employees_add_do</title>
	</head>
	<body>
		<%
			request.setCharacterEncoding("UTF-8");
			Employees employees = new Employees();
			String name = ParamUtil.getString(request, "name", "");
			String namepy = ToPinyin.getPinYin(name);
			//System.out.println(namepy);

			employees.setArea_id(ParamUtil.getInt(request, "area_id", 0));
			employees.setBaby_birth(ParamUtil.getString(request, "baby_birth",
					""));
			employees.setBirthday(ParamUtil.getString(request, "birthday", ""));
			employees.setCellphone(ParamUtil
					.getString(request, "cellphone", ""));
			employees.setEdu_level(ParamUtil
					.getString(request, "edu_level", ""));
			employees.setEmail(ParamUtil.getString(request, "email", ""));
			employees.setFamily_address(ParamUtil.getString(request,
					"family_address", ""));
			employees.setGender(ParamUtil.getString(request, "gender", ""));
			employees.setHome_type(ParamUtil
					.getString(request, "home_type", ""));
			employees.setIdcard(ParamUtil.getString(request, "idcard", ""));
			employees.setIs_married(ParamUtil.getString(request, "is_married",
					""));
			employees.setName(ParamUtil.getString(request, "name", ""));
			employees.setNamepy(namepy);
			employees.setNation(ParamUtil.getInt(request, "nation", 0));
			employees.setPassword(ParamUtil.getString(request, "password", ""));
			employees.setPhone(ParamUtil.getString(request, "phone", ""));
			employees.setPolity(ParamUtil.getInt(request, "polity", 0));
			employees.setPosition(ParamUtil.getInt(request, "position", 0));
			employees.setStart_time(ParamUtil.getString(request, "start_time",
					""));
			employees.setUsername(ParamUtil.getString(request, "username", ""));

			if (EmployeesControl.addEmployees(employees)) {
		%>
		<script>
if (window.confirm("添加成功,是否继续添加跟单？")) {
	window.location.href = "employees_add.jsp";
} else {
	window.location.href = "employees.jsp";
}
</script>
		<%
			} else {
		%>
		<script>
alert("添加失败");
history.go(-1);
</script>
		<%
			}
		%>
	</body>
</html>